package com.ruoyi.medicine.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.medicine.mapper.MedicineMapper;
import com.ruoyi.medicine.domain.Medicine;
import com.ruoyi.medicine.service.IMedicineService;

/**
 * 药品库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class MedicineServiceImpl implements IMedicineService 
{
    @Autowired
    private MedicineMapper medicineMapper;

    /**
     * 查询药品库存
     * 
     * @param id 药品库存主键
     * @return 药品库存
     */
    @Override
    public Medicine selectMedicineById(Long id)
    {
        return medicineMapper.selectMedicineById(id);
    }

    /**
     * 查询药品库存列表
     * 
     * @param medicine 药品库存
     * @return 药品库存
     */
    @Override
    public List<Medicine> selectMedicineList(Medicine medicine)
    {
        return medicineMapper.selectMedicineList(medicine);
    }

    /**
     * 新增药品库存
     * 
     * @param medicine 药品库存
     * @return 结果
     */
    @Override
    public int insertMedicine(Medicine medicine)
    {
        medicine.setCreateTime(DateUtils.getNowDate());
        return medicineMapper.insertMedicine(medicine);
    }

    /**
     * 修改药品库存
     * 
     * @param medicine 药品库存
     * @return 结果
     */
    @Override
    public int updateMedicine(Medicine medicine)
    {
        medicine.setUpdateTime(DateUtils.getNowDate());
        return medicineMapper.updateMedicine(medicine);
    }

    /**
     * 批量删除药品库存
     * 
     * @param ids 需要删除的药品库存主键
     * @return 结果
     */
    @Override
    public int deleteMedicineByIds(Long[] ids)
    {
        return medicineMapper.deleteMedicineByIds(ids);
    }

    /**
     * 删除药品库存信息
     * 
     * @param id 药品库存主键
     * @return 结果
     */
    @Override
    public int deleteMedicineById(Long id)
    {
        return medicineMapper.deleteMedicineById(id);
    }
}
